#if UNITY_2019_1_OR_NEWER

using System;
using Pinwheel.LSerialize.Formatters;
using UnityEngine;

namespace Pinwheel.LSerialize
{
    public static partial class LFormatterProvider
    {
        static void UnityRegister<T>()
            where T : unmanaged, IEquatable<T>
        {
            Register(new UnmanagedFormatter<T>());
            Register(new UnmanagedArrayFormatter<T>());
            Register(new ListFormatter<T>());
        }

        static partial void RegisterExtensionFormatters()
        {
            // struct
            UnityRegister<UnityEngine.Vector2>();
            UnityRegister<UnityEngine.Vector3>();
            UnityRegister<UnityEngine.Vector4>();
            UnityRegister<UnityEngine.Quaternion>();
            UnityRegister<UnityEngine.Color>();
            UnityRegister<UnityEngine.Bounds>();
            UnityRegister<UnityEngine.Rect>();
            // UnityRegister<UnityEngine.Keyframe>();
            Register(new UnmanagedFormatter<UnityEngine.Keyframe>()); 
            Register(new UnmanagedFormatter<UnityEngine.WrapMode>());
            UnityRegister<UnityEngine.Matrix4x4>();
            // UnityRegister<UnityEngine.GradientColorKey>();
            Register(new UnmanagedFormatter<UnityEngine.GradientColorKey>()); 
            // UnityRegister<UnityEngine.GradientAlphaKey>();
            Register(new UnmanagedFormatter<UnityEngine.GradientAlphaKey>());
            Register(new UnmanagedFormatter<UnityEngine.GradientMode>());
            // UnityRegister<UnityEngine.Color32>();
            Register(new UnmanagedFormatter<UnityEngine.Color32>());
            // UnityRegister<UnityEngine.LayerMask>();
            Register(new UnmanagedFormatter<UnityEngine.LayerMask>());
            UnityRegister<UnityEngine.Vector2Int>();
            UnityRegister<UnityEngine.Vector3Int>();
            // UnityRegister<UnityEngine.RangeInt>();
            Register(new UnmanagedFormatter<UnityEngine.RangeInt>());
            UnityRegister<UnityEngine.RectInt>();
            UnityRegister<UnityEngine.BoundsInt>();

            // // class
            // if (!IsRegistered<AnimationCurve>())
            // {
            //     Register(new AnimationCurveFormatter());
            //     Register(new ArrayFormatter<AnimationCurve>());
            //     Register(new ListFormatter<AnimationCurve>());
            // }
            // if (!IsRegistered<Gradient>())
            // {
            //     Register(new GradientFormatter());
            //     Register(new ArrayFormatter<Gradient>());
            //     Register(new ListFormatter<Gradient>());
            // }
            // if (!IsRegistered<RectOffset>())
            // {
            //     Register(new RectOffsetFormatter());
            //     Register(new ArrayFormatter<RectOffset>());
            //     Register(new ListFormatter<RectOffset>());
            // }
        }
    }
}

#endif